package com.masterlau.entry;

import org.apache.maven.shared.invoker.InvokerLogger;
import org.slf4j.Logger;

/**
 * @author MasterLau
 */
final class Log implements InvokerLogger {
    private final Logger delegate;
    private int threshold;

    public Log(Logger delegate) {
        this(delegate, INFO);
    }

    public Log(Logger delegate, int threshold) {
        this.delegate = delegate;
        this.threshold = threshold;
    }

    @Override
    public void debug(String message) {
        delegate.info(message);
    }

    @Override
    public void debug(String message, Throwable throwable) {
        delegate.info(message, throwable);
    }

    @Override
    public boolean isDebugEnabled() {
        return threshold >= DEBUG;
    }

    @Override
    public void info(String message) {
        delegate.info(message);
    }

    @Override
    public void info(String message, Throwable throwable) {
        delegate.info(message, throwable);
    }

    @Override
    public boolean isInfoEnabled() {
        return threshold >= INFO;
    }

    @Override
    public void warn(String message) {
        delegate.info(message);
    }

    @Override
    public void warn(String message, Throwable throwable) {
        delegate.info(message, throwable);
    }

    @Override
    public boolean isWarnEnabled() {
        return threshold >= WARN;
    }

    @Override
    public void error(String message) {
        delegate.info(message);
    }

    @Override
    public void error(String message, Throwable throwable) {
        delegate.info(message, throwable);
    }

    @Override
    public boolean isErrorEnabled() {
        return threshold >= ERROR;
    }

    @Override
    public void fatalError(String message) {
        delegate.info(message);
    }

    @Override
    public void fatalError(String message, Throwable throwable) {
        delegate.info(message, throwable);
    }

    @Override
    public boolean isFatalErrorEnabled() {
        return threshold >= FATAL;
    }

    @Override
    public int getThreshold() {
        return threshold;
    }

    @Override
    public void setThreshold(int threshold) {
        this.threshold = threshold;
    }
}
